package com.xsy.camera2.opengl

import android.content.Context
import java.io.ByteArrayOutputStream

object FileUtils {
    fun getAsset(context: Context, path: String): String {
        val result = ByteArrayOutputStream()
        val inputStream = context.assets.open(path)
        val buffer = ByteArray(1024)

        while (true) {
            val length = inputStream.read(buffer)
            if (length <= 0) {
                break
            }
            result.write(buffer, 0, length)
        }
        inputStream.close()
        result.close()
        return result.toString("UTF-8")
    }
}